﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using StoreManagementSystem.DataAccessLayer;
using StoreManagementSystem.DomainObjects;
using System.Web;
using System.Configuration;

namespace TesterWeb
{
    [TestFixture]
    public class FactoyTester
    {
        [Test]
        public void connectionStringTest()
        {
            Assert.AreEqual(ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString, "SERVER=74.86.130.69;DATABASE=storemansys;UID=storeroot;PASSWORD=store2010;");
        }

        [Test]
        public void creationTests()
        {
           SQLDAOFactory factory = new SQLDAOFactory(new SQLDataProvider("MySQlConnectionString"));

           var storeUserTest
               = factory.createDAO("storeuser");
           Assert.IsInstanceOf<SQLStoreUserDAO>(storeUserTest);

           var productTest
              = factory.createDAO("product");
           Assert.IsInstanceOf<SQLProductDAO>(productTest);

           var brandTest
             = factory.createDAO("brand");
           Assert.IsInstanceOf<SQLBrandDAO>(brandTest);

           var categoryTest
                = factory.createDAO("category");
           Assert.IsInstanceOf<SQLCategoryDAO>(categoryTest);

           var aisleTest
               = factory.createDAO("aisle");
           Assert.IsInstanceOf<SQLBrandDAO>(aisleTest);
        }

    }
}